#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> vv;
        vv.push_back({ 1 });
        vector<int> rem;
        rem.push_back(1);
        for (int i = 1; i < numRows; i++) {
            vv.push_back(rem);
            for (int j = 1; j < i; j++) {
                vv[i].push_back(vv[i - 1][j - 1] + vv[i - 1][j]);
            }
            vv[i].push_back(1);
        }
        return vv;
    }
};

int main()
{
    Solution ss;
    vector<vector<int>> vv = ss.generate(5);
    for (int i = 0; i < vv.size(); i++) {
        for (int j = 0; j < vv[i].size(); j++) {
            cout << vv[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}